import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner scanner =new Scanner(System.in);
        System.out.println("请输入要判断的数字：");
        while(scanner.hasNextInt()) {  //多组输入
            int n = scanner.nextInt();
            int i=0;
            for ( i = 2; i <= n; i++) {
                if(n%i==0){
                    break;
                }
            }
            if(i==n){
                System.out.println(n+"是素数");
            }else{
                System.out.println(n+"不是素数");
            }
        }
        }

    public static void main4(String[] args) {
        int count=0;
        for (int i = 1; i < 100; i++) {
            if(i%10==9) {
                count++;
            }
            if(i/10==9){
                count++;
            }
        }
        System.out.println("1到100出现9的次数为："+count);
    }
    public static void main3(String[] args) {
        int i=1;
        while(i<=100){
            if(i%3==0 && i%5==0){
                System.out.println(i);
                i++;
                continue;
            }
            i++;
        }
    }
    public static void main2(String[] args) {
        int i=1;
        int sum=0;
        while(i<=5){
            int ret=1;
            int n=1;
            while(n<=i){//计算i的阶乘
                ret*=n;
                n++;
            }
            sum+=ret;
            i++;
        }
        System.out.println(sum);
    }
    public static void main1(String[] args) {
       int sum=0;
       int ret=1;
       int i=1;
       while(i<=5){
           ret*=i;//计算i的阶乘
           sum+=ret;//累加
           i++;//调整
       }
        System.out.println(sum);//计算1的阶乘加到5的阶乘
    }
}
